package com.shop.mapper;

import com.shop.entity.CommentsReply;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentsReplyMapper {

    /**
     * 增加回复
     * @param commentsReply
     */
    @Insert("insert into comments_reply(comment_id,reply_content,to_id,to_name,to_avatar,create_time,update_time)" +
            "values (#{commentId},#{replyContent},#{toId},#{toName},#{toAvatar},#{createTime},#{updateTime})")
    void saveReply(CommentsReply commentsReply);

    @Delete("delete from comments_reply where comment_id = #{id}")
    void delete(Long id);

    @Select("select * from comments_reply where comment_id = #{id}")
    CommentsReply getById(Long id);

    @Select("select * from comments_reply")
    CommentsReply list();
}
